<template>
	<view>
		点击事件、下拉刷新事件、页面触底
		<button type="primary" @click="clicked(123,$event)">按钮1</button>
		<view class="box" v-for="item in list">
			{{item}}
		</view>
		<button @click="pullDown">点击刷新</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: ['前端','JAVA','UI','测试','产品','策划']
			}
		},
		onPullDownRefresh() {
			console.log('下拉刷新...');
			setTimeout(() => {
				this.list.reverse();	//数据list反转
				uni.stopPullDownRefresh(); 	//数据加载完成，停用下拉刷新样式
			},2000);
		},
		onReachBottom() {
			console.log("页面触底事件..");
			this.list = [...this.list,...[Math.random()]];	//拼接
		},
		methods: {
			clicked(num,e){
				console.log('按钮1',num,e);
			},
			pullDown(){
				uni.startPullDownRefresh();
			}
		}
	}
</script>

<style>
	.box{
		height: 100px;
		line-height: 100px;
	}
</style>
